﻿using Newtonsoft.Json;
using Proto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace GameServer.Battle
{
    public class AttributeData
    {
        public int Hp { get; set; }
        public int Mp { get; set; }
        public int Attack { get; set; }
        public int Magic { get; set; }
        public int Defense { get; set; }
        public int MagicDefense { get; set; }
        public int Speed { get; set; }
        public int Baoji { get; set; }
        public int BaojiDefense { get; set; }
        public void Merge(AttributeData data)
        {
            this.Hp += data.Hp;
            this.Mp += data.Mp;
            this.Attack += data.Attack;
            this.Magic += data.Magic;
            this.Defense += data.Defense;
            this.MagicDefense += data.MagicDefense;
            this.Speed += data.Speed;
            this.Baoji += data.Baoji;
            this.BaojiDefense += data.BaojiDefense;
        }
        public void Sub(AttributeData data)
        {
            this.Hp -= data.Hp;
            this.Mp -= data.Mp;
            this.Attack -= data.Attack;
            this.Magic -= data.Magic;
            this.Defense -= data.Defense;
            this.MagicDefense -= data.MagicDefense;
            this.Speed -= data.Speed;
            this.Baoji -= data.Baoji;
            this.BaojiDefense -= data.BaojiDefense;
        }
        public void Reset()
        {
            this.Hp = 0;
            this.Mp = 0;
            this.Attack = 0;
            this.Magic = 0;
            this.Defense = 0;
            this.MagicDefense = 0;
            this.Speed = 0;
            this.Baoji = 0;
            this.BaojiDefense = 0;
        }

        public override string ToString()
        {
            return JsonConvert.SerializeObject(this);
        }
    }
}
